package c.j.a.d.a.k.a;

import java.io.IOException;
import java.io.InputStream;

/* compiled from: AXmlResourceParser */
public class a implements e {
    public c a;
    public boolean b = false;
    public d c;
    public a d = new a();
    public boolean e;
    public int f;
    public int g;
    public int[] h;
    public int i;

    /* compiled from: AXmlResourceParser */
    public static final class a {
        public int[] a = new int[32];
        public int b;
        public int c;

        public final void a(int i) {
            int[] iArr = this.a;
            int length = iArr.length;
            int i2 = this.b;
            length -= i2;
            if (length <= i) {
                int[] iArr2 = new int[((iArr.length + length) * 2)];
                System.arraycopy(iArr, 0, iArr2, 0, i2);
                this.a = iArr2;
            }
        }

        public final void b() {
            a(2);
            int i = this.b;
            int[] iArr = this.a;
            iArr[i] = 0;
            iArr[i + 1] = 0;
            this.b = i + 2;
            this.c++;
        }
    }

    public a() {
        d();
    }

    public String a(int i) {
        i = this.h[c(i) + 1];
        if (i == -1) {
            return "";
        }
        return this.c.a(i);
    }

    public void b() {
        if (this.b) {
            this.b = false;
            c cVar = this.a;
            InputStream inputStream = cVar.a;
            if (inputStream != null) {
                try {
                    inputStream.close();
                } catch (IOException unused) {
                }
                cVar.a = null;
                cVar.b = false;
                cVar.c = 0;
            }
            this.a = null;
            this.c = null;
            a aVar = this.d;
            aVar.b = 0;
            aVar.c = 0;
            d();
        }
    }

    public final int c(int i) {
        if (this.f == 2) {
            int i2 = i * 5;
            if (i2 < this.h.length) {
                return i2;
            }
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append("Invalid attribute index (");
            stringBuilder.append(i);
            stringBuilder.append(").");
            throw new IndexOutOfBoundsException(stringBuilder.toString());
        }
        throw new IndexOutOfBoundsException("Current event is not START_TAG.");
    }

    public final void d() {
        this.f = -1;
        this.g = -1;
        this.h = null;
        this.i = -1;
    }

    /* JADX WARNING: Missing block: B:52:0x012a, code skipped:
            throw new java.io.IOException(r2.toString());
     */
    /* JADX WARNING: Missing block: B:91:0x0248, code skipped:
            throw new java.io.IOException(r2.toString());
     */
    public final void e() throws java.io.IOException {
        /*
        r14 = this;
        r0 = r14.c;
        r1 = ").";
        r2 = 4;
        r3 = 1;
        if (r0 != 0) goto L_0x009f;
    L_0x0008:
        r0 = r14.a;
        r4 = 524291; // 0x80003 float:7.34688E-40 double:2.59034E-318;
        c.j.a.c.y.a.i.m(r0, r4);
        r0 = r14.a;
        r0.c();
        r0 = r14.a;
        r4 = 1835009; // 0x1c0001 float:2.571395E-39 double:9.06615E-318;
        c.j.a.c.y.a.i.m(r0, r4);
        r4 = r0.a();
        r5 = r0.a();
        r6 = r0.a();
        r0.a();
        r7 = r0.a();
        r8 = r0.a();
        r9 = new c.j.a.d.a.k.a.d;
        r9.m2347init();
        r5 = r0.b(r5);
        r9.a = r5;
        if (r6 == 0) goto L_0x0044;
    L_0x0041:
        r0.b(r6);
    L_0x0044:
        if (r8 != 0) goto L_0x0048;
    L_0x0046:
        r5 = r4;
        goto L_0x0049;
    L_0x0048:
        r5 = r8;
    L_0x0049:
        r5 = r5 - r7;
        r6 = r5 % 4;
        if (r6 != 0) goto L_0x0085;
    L_0x004e:
        r5 = r5 / r2;
        r5 = r0.b(r5);
        r9.b = r5;
        if (r8 == 0) goto L_0x007b;
    L_0x0057:
        r4 = r4 - r8;
        r5 = r4 % 4;
        if (r5 != 0) goto L_0x0061;
    L_0x005c:
        r4 = r4 / r2;
        r0.b(r4);
        goto L_0x007b;
    L_0x0061:
        r0 = new java.io.IOException;
        r2 = new java.lang.StringBuilder;
        r2.<init>();
        r3 = "Style data size is not multiple of 4 (";
        r2.append(r3);
        r2.append(r4);
        r2.append(r1);
        r1 = r2.toString();
        r0.<init>(r1);
        throw r0;
    L_0x007b:
        r14.c = r9;
        r0 = r14.d;
        r0.b();
        r14.b = r3;
        goto L_0x009f;
    L_0x0085:
        r0 = new java.io.IOException;
        r2 = new java.lang.StringBuilder;
        r2.<init>();
        r3 = "String data size is not multiple of 4 (";
        r2.append(r3);
        r2.append(r5);
        r2.append(r1);
        r1 = r2.toString();
        r0.<init>(r1);
        throw r0;
    L_0x009f:
        r0 = r14.f;
        if (r0 == r3) goto L_0x0249;
    L_0x00a3:
        r14.d();
    L_0x00a6:
        r4 = r14.e;
        r5 = 0;
        r6 = 2;
        r7 = -1;
        if (r4 == 0) goto L_0x00cb;
    L_0x00ad:
        r14.e = r5;
        r4 = r14.d;
        r8 = r4.b;
        if (r8 == 0) goto L_0x00cb;
    L_0x00b5:
        r9 = r8 + -1;
        r10 = r4.a;
        r10 = r10[r9];
        r9 = r9 + r7;
        r10 = r10 * 2;
        r9 = r9 - r10;
        if (r9 == 0) goto L_0x00cb;
    L_0x00c1:
        r10 = r10 + 2;
        r8 = r8 - r10;
        r4.b = r8;
        r8 = r4.c;
        r8 = r8 + r7;
        r4.c = r8;
    L_0x00cb:
        r4 = 3;
        if (r0 != r4) goto L_0x00e6;
    L_0x00ce:
        r8 = r14.d;
        r9 = r8.c;
        if (r9 != r3) goto L_0x00e6;
    L_0x00d4:
        r9 = r8.b;
        if (r9 != 0) goto L_0x00da;
    L_0x00d8:
        r8 = 0;
        goto L_0x00e0;
    L_0x00da:
        r9 = r9 + -1;
        r8 = r8.a;
        r8 = r8[r9];
    L_0x00e0:
        if (r8 != 0) goto L_0x00e6;
    L_0x00e2:
        r14.f = r3;
        goto L_0x01c8;
    L_0x00e6:
        r8 = 1048834; // 0x100102 float:1.46973E-39 double:5.18193E-318;
        if (r0 != 0) goto L_0x00ef;
    L_0x00eb:
        r9 = 1048834; // 0x100102 float:1.46973E-39 double:5.18193E-318;
        goto L_0x00f5;
    L_0x00ef:
        r9 = r14.a;
        r9 = r9.a();
    L_0x00f5:
        r10 = 524672; // 0x80180 float:7.35222E-40 double:2.592224E-318;
        if (r9 != r10) goto L_0x012b;
    L_0x00fa:
        r4 = r14.a;
        r4 = r4.a();
        r5 = 8;
        if (r4 < r5) goto L_0x0111;
    L_0x0104:
        r5 = r4 % 4;
        if (r5 != 0) goto L_0x0111;
    L_0x0108:
        r5 = r14.a;
        r4 = r4 / 4;
        r4 = r4 - r6;
        r5.b(r4);
        goto L_0x00a6;
    L_0x0111:
        r0 = new java.io.IOException;
        r2 = new java.lang.StringBuilder;
        r2.<init>();
        r3 = "Invalid resource ids size (";
        r2.append(r3);
        r2.append(r4);
        r2.append(r1);
        r1 = r2.toString();
        r0.<init>(r1);
        throw r0;
    L_0x012b:
        r10 = 1048832; // 0x100100 float:1.469727E-39 double:5.18192E-318;
        if (r9 < r10) goto L_0x022f;
    L_0x0130:
        r11 = 1048836; // 0x100104 float:1.469732E-39 double:5.18194E-318;
        if (r9 > r11) goto L_0x022f;
    L_0x0135:
        if (r9 != r8) goto L_0x013d;
    L_0x0137:
        if (r0 != r7) goto L_0x013d;
    L_0x0139:
        r14.f = r5;
        goto L_0x01c8;
    L_0x013d:
        r5 = r14.a;
        r5.c();
        r5 = r14.a;
        r5 = r5.a();
        r7 = r14.a;
        r7.c();
        if (r9 == r10) goto L_0x01c9;
    L_0x014f:
        r7 = 1048833; // 0x100101 float:1.469728E-39 double:5.181924E-318;
        if (r9 != r7) goto L_0x0156;
    L_0x0154:
        goto L_0x01c9;
    L_0x0156:
        r14.g = r5;
        if (r9 != r8) goto L_0x019f;
    L_0x015a:
        r0 = r14.a;
        r0.a();
        r0 = r14.a;
        r0.a();
        r0 = r14.a;
        r0.c();
        r0 = r14.a;
        r0 = r0.a();
        r1 = 65535; // 0xffff float:9.1834E-41 double:3.23786E-319;
        r0 = r0 & r1;
        r2 = r14.a;
        r2 = r2.a();
        r14.i = r2;
        r1 = r1 & r2;
        r1 = r1 - r3;
        r14.i = r1;
        r1 = r14.a;
        r0 = r0 * 5;
        r0 = r1.b(r0);
        r14.h = r0;
    L_0x0189:
        r0 = r14.h;
        r1 = r0.length;
        if (r4 >= r1) goto L_0x0197;
    L_0x018e:
        r1 = r0[r4];
        r1 = r1 >>> 24;
        r0[r4] = r1;
        r4 = r4 + 5;
        goto L_0x0189;
    L_0x0197:
        r0 = r14.d;
        r0.b();
        r14.f = r6;
        goto L_0x01c8;
    L_0x019f:
        r5 = 1048835; // 0x100103 float:1.469731E-39 double:5.181933E-318;
        if (r9 != r5) goto L_0x01b3;
    L_0x01a4:
        r0 = r14.a;
        r0.a();
        r0 = r14.a;
        r0.a();
        r14.f = r4;
        r14.e = r3;
        goto L_0x01c8;
    L_0x01b3:
        if (r9 == r11) goto L_0x01b7;
    L_0x01b5:
        goto L_0x00a6;
    L_0x01b7:
        r0 = r14.a;
        r0.a();
        r0 = r14.a;
        r0.c();
        r0 = r14.a;
        r0.c();
        r14.f = r2;
    L_0x01c8:
        return;
    L_0x01c9:
        if (r9 != r10) goto L_0x0201;
    L_0x01cb:
        r4 = r14.a;
        r4 = r4.a();
        r5 = r14.a;
        r5 = r5.a();
        r7 = r14.d;
        r8 = r7.c;
        if (r8 != 0) goto L_0x01e0;
    L_0x01dd:
        r7.b();
    L_0x01e0:
        r7.a(r6);
        r8 = r7.b;
        r9 = r8 + -1;
        r10 = r7.a;
        r11 = r10[r9];
        r12 = r9 + -1;
        r13 = r11 * 2;
        r12 = r12 - r13;
        r11 = r11 + r3;
        r10[r12] = r11;
        r10[r9] = r4;
        r4 = r9 + 1;
        r10[r4] = r5;
        r9 = r9 + r6;
        r10[r9] = r11;
        r8 = r8 + r6;
        r7.b = r8;
        goto L_0x00a6;
    L_0x0201:
        r4 = r14.a;
        r4.c();
        r4 = r14.a;
        r4.c();
        r4 = r14.d;
        r5 = r4.b;
        if (r5 != 0) goto L_0x0213;
    L_0x0211:
        goto L_0x00a6;
    L_0x0213:
        r6 = r5 + -1;
        r7 = r4.a;
        r8 = r7[r6];
        if (r8 != 0) goto L_0x021d;
    L_0x021b:
        goto L_0x00a6;
    L_0x021d:
        r8 = r8 + -1;
        r6 = r6 + -2;
        r7[r6] = r8;
        r9 = r8 * 2;
        r9 = r9 + r3;
        r6 = r6 - r9;
        r7[r6] = r8;
        r5 = r5 + -2;
        r4.b = r5;
        goto L_0x00a6;
    L_0x022f:
        r0 = new java.io.IOException;
        r2 = new java.lang.StringBuilder;
        r2.<init>();
        r3 = "Invalid chunk type (";
        r2.append(r3);
        r2.append(r9);
        r2.append(r1);
        r1 = r2.toString();
        r0.<init>(r1);
        throw r0;
    L_0x0249:
        return;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.j.a.d.a.k.a.a.e():void");
    }
}
